#include <iostream>
#include <fstream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <sstream>
#include<iomanip>
#include<time.h>
using namespace std;
const int D = 3; //the number of dimensions to use: X, Y, Z
const int M = 8; //output symbols
const int N = 8; //states
const int LR = 2; //degree of play in the left-to-right HMM transition matrix
const int R = 10; //the number of capture (in a sample)/ number of row
typedef struct{
    double** data_x;
    int num=0;
    double** data_y;
    double** data_z;
}data_t;
double** readFile( int* num, char* file);
int count_element(double** data);
double** max_data(double** data,int num);
double** min_data(double** data,int num);
double sum_matrix(double** data,int ro,int co);
double** sub_matrix(double** data1, double** data2,int ro,int co);
double** mul_matrix(double** data1, double** data2);
double** get_point_centroids(data_t data,int K, int D);
double**  kmeans(double** data, int nbCluster);
double** get_point_clusters(data_t data, double** centroids,int D);
double** prior_transition_matrix(int K,int LR);
double** dhmm_numeric(double** X, double** P, int *bins, int K, int cyc, double tol);



int processEvent();
